Thirteen years and more than 2,000 American casualties after it began , the war in Afghanistan will conclude responsibly , President Barack Obama said on Sunday .

In a written statement marking the formal end of U.S. combat there , Obama said the remaining 10,000 or so American troops in Afghanistan would still face danger but that the longest U.S. war ever was now history .

`` Our personnel will continue to face risks , but this reflects the enduring commitment of the United States to the Afghan people and to a united , secure and sovereign Afghanistan that is never again used as a source of attacks against our nation , '' Obama said .

American troops went to fight in Afghanistan following the Sept. 11 , 2001 , terrorist attacks , and the U.S. spent more than $ 1 trillion dollars there and lost upwards of 2,200 servicemen and women .

Obama vowed to wind the Afghan war down when he took office , eventually announcing this year he would reduce the number of troops stationed there to about 10,000 -- a massive reduction from the nearly 150,000 who once served .

In a ceremony in Afghanistan 's capital of Kabul on Sunday , the commander of the International Security Assistance Force officially marked the end of coalition combat in Afghanistan by rolling up the ISAF flag .

The city has suffered an uptick in Taliban violence as the drawdown date approached , though U.S. officials maintain the country is far better off now than when the U.S. began its mission 13 years ago .

`` Our courageous military and diplomatic personnel in Afghanistan -- along with our NATO allies and coalition partners -- have helped the Afghan people reclaim their communities , take the lead for their own security , hold historic elections and complete the first democratic transfer of power in their country 's history , '' Obama said .

The President has spent much of last year marking the withdrawal of combat troops in Afghanistan , from his announcement in May that U.S. combat troops would leave the country by January 2015 , to an appearance at Fort Dix earlier this month acknowledging persistent security challenges there .

`` Afghanistan is still a very dangerous place , '' Obama said at the New Jersey base . `` But I want you , and every American who has served in Afghanistan , to be proud of what you 've accomplished there . ''

RELATED : 2 American soldiers , 19 Afghans killed

Currently on vacation with his family in Hawaii , the President used a Christmas address to Marines stationed on Oahu to hail the achievements of the U.S. military in Afghanistan , asserting the U.S. is safer because of the effort there .

Afghanistan is `` not going to be a source of terrorist attacks again , '' he said at the Marine Corps Base Hawaii in Kaneohe Bay .

Other U.S. officials -- including Vice President Joe Biden and Defense Secretary Chuck Hagel -- have also marked the end of the U.S. combat mission in Afghanistan . Hagel said Sunday the work of U.S. troops has `` made our world safer and given Afghanistan the opportunity to chart a secure , democratic , and prosperous future . ''

Sen. John McCain , the Arizona Republican , visited Kabul on Christmas to meet with Afghanistan 's new president .

@highlight

Obama says Afghanistan better off after 13 years of war

@highlight

Afghan war is coming to responsible end , Obama says

@highlight

About 10,000 U.S. troops will remain in Afghanistan next year